﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CompanyRegNumControl.ascx.cs"
    Inherits="TeamTime.CompanyRegNumControl" %>
<asp:DropDownList ID="ddlCompanyTypeID" runat="server" Enabled="false" AutoPostBack="true"
    OnSelectedIndexChanged="ddlCompanyTypeID_SelectedIndexChanged">
</asp:DropDownList>
&nbsp; <span id="spRegNum" runat="server" visible="false">
    <asp:TextBox ID="txtCompanyRegistrationNum1" runat="server" MaxLength="4" size="2"
        onKeyUp="Javascript:if(this.value.length==4){gotoBox2();}" onblur="Javascript:pad(this,4);"
        ReadOnly="true" ValidationGroup="popup"></asp:TextBox>
        <asp:RequiredFieldValidator ID="reqValCompanyRegistrationNum" runat="server" ControlToValidate="txtCompanyRegistrationNum1"
        Display="Dynamic" ErrorMessage="* Required" ValidationGroup="popup"></asp:RequiredFieldValidator>
    <asp:TextBox ID="txtCompanyRegistrationNum2" runat="server" MaxLength="6" size="3"
        onKeyUp="Javascript:if(this.value.length==6){gotoBox3();}" onblur="Javascript:pad(this,6);"
        ReadOnly="true" ValidationGroup="popup"></asp:TextBox>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtCompanyRegistrationNum2"
        Display="Dynamic" ErrorMessage="* Required" ValidationGroup="popup"></asp:RequiredFieldValidator>
    <asp:TextBox ID="txtCompanyRegistrationNum3" runat="server" MaxLength="2" size="1"
        onblur="Javascript:pad(this,2);" ReadOnly="true" ValidationGroup="popup"></asp:TextBox>
    
    
    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtCompanyRegistrationNum3"
        Display="Dynamic" ErrorMessage="* Required" ValidationGroup="popup"></asp:RequiredFieldValidator>

    <script type="text/javascript">
        function gotoBox2() {
            var box2 = document.getElementById('<%=txtCompanyRegistrationNum2.ClientID %>');
            box2.focus();
        }
        function gotoBox3() {
            var box3 = document.getElementById('<%=txtCompanyRegistrationNum3.ClientID %>');
            box3.focus();
        }
        function pad(box, leng) {
            for (var i = 0; i < leng; i++) {
                if (box.value.length < leng) {
                    box.value = '0' + box.value;
                }
            }
        }
    </script>

</span>